Use a row reference, not a path, to associate separators with their tree
authorMatthias Clasen <mclasen@redhat.com>
Tue, 9 Nov 2004 16:38:57 +0000 (16:38 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 9 Nov 2004 16:38:57 +0000 (16:38 +0000)
2004-11-09  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkcombobox.c (find_menu_by_path)
(gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted):
Use a row reference, not a path, to associate separators
with their tree row.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c

index 3a0b4e2c2ead4566787b62d8c4c2178d64a1021e..4d6f44551bfc6af2aba1955b70710401811da513 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-11-09  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcombobox.c (find_menu_by_path) 
+       (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): 
+       Use a row reference, not a path, to associate separators
+       with their tree row.  
+       
        * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): 
        Show the grip_window if necessary.  
 
index 3a0b4e2c2ead4566787b62d8c4c2178d64a1021e..4d6f44551bfc6af2aba1955b70710401811da513 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-09  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcombobox.c (find_menu_by_path) 
+       (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): 
+       Use a row reference, not a path, to associate separators
+       with their tree row.  
+       
        * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): 
        Show the grip_window if necessary.  
 
index 3a0b4e2c2ead4566787b62d8c4c2178d64a1021e..4d6f44551bfc6af2aba1955b70710401811da513 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-09  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcombobox.c (find_menu_by_path) 
+       (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): 
+       Use a row reference, not a path, to associate separators
+       with their tree row.  
+       
        * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): 
        Show the grip_window if necessary.  
 
index 3a0b4e2c2ead4566787b62d8c4c2178d64a1021e..4d6f44551bfc6af2aba1955b70710401811da513 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-09  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcombobox.c (find_menu_by_path) 
+       (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): 
+       Use a row reference, not a path, to associate separators
+       with their tree row.  
+       
        * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): 
        Show the grip_window if necessary.  
 
index 9a4976a24aa15963df5444b27be410db6a167efc..c8cca85d81fe0e65fd71af884c62f2a411395bee 100644 (file)
@@ -2384,6 +2384,7 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
   gboolean is_separator;
   gint i, n_children;
   GtkWidget *last;
+  GtkTreePath *path;
   
   n_children = gtk_tree_model_iter_n_children (model, parent);
   
@@ -2401,10 +2402,11 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
       if (is_separator)
        {
          item = gtk_separator_menu_item_new ();
+         path = gtk_tree_model_get_path (model, &iter);
          g_object_set_data_full (G_OBJECT (item),
                                  "gtk-combo-box-item-path",
-                                 gtk_tree_model_get_path (model, &iter),
-                                 (GDestroyNotify)gtk_tree_path_free);
+                                 gtk_tree_row_reference_new (model, path),
+                                 (GDestroyNotify)gtk_tree_row_reference_free);
        }
       else
        {
@@ -2754,6 +2756,7 @@ find_menu_by_path (GtkWidget   *menu,
   GList *i, *list;
   GtkWidget *item;
   GtkWidget *submenu;    
+  GtkTreeRowReference *mref;
   GtkTreePath *mpath;
   gboolean skip;
 
@@ -2764,12 +2767,13 @@ find_menu_by_path (GtkWidget   *menu,
     {
       if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
        {
-         
-         mpath = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
-         if (!mpath)
+         mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
+         if (!mref)
            continue;
-         
-         mpath = gtk_tree_path_copy (mpath);
+         else if (!gtk_tree_row_reference_valid (mref))
+           mpath = NULL;
+         else
+           mpath = gtk_tree_row_reference_get_path (mref);
        }
       else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child))
        {
@@ -2914,8 +2918,8 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
       item = gtk_separator_menu_item_new ();
       g_object_set_data_full (G_OBJECT (item),
                              "gtk-combo-box-item-path",
-                             gtk_tree_path_copy (path),
-                             (GDestroyNotify)gtk_tree_path_free);
+                             gtk_tree_row_reference_new (model, path),
+                             (GDestroyNotify)gtk_tree_row_reference_free);
     }
   else
     {